package org.azj.dbOperatorComponent;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.naming.NamingException;
import javax.sql.DataSource;

import org.ht.database.BlobToImageHelper;

import com.ibm.db2.jcc.DB2SimpleDataSource;


public class Main {

	public static void main(String[] args) throws NamingException, SQLException{
		DB2SimpleDataSource db2ds = new DB2SimpleDataSource();
		//db2ds.setPortNumber(arg0);
		
		db2ds.setServerName("192.168.1.6");
		db2ds.setPortNumber(50000);
		db2ds.setDatabaseName("DBTEST");                          
		
        // Description for documentation
		db2ds.setUser("aicro");
        // Assign the user ID
		db2ds.setPassword("aizhijie1104");
        
		DataSource dataSource = db2ds;
		
		
		// 初始测试
		TestGetTableInfoAndSelect(dataSource);
		
		// update
		TestGetTableInfoAndUpdate(dataSource);
		
		// 回复原样
		TestGetTableInfoAndSelect(dataSource);
		
		// transaction ok
		TestGetTableInfoAndTransactionOk(dataSource);
		
		// 回复原样
		TestGetTableInfoAndSelect(dataSource);
		
		// partial insert
		TestInsertPartial(dataSource);
		
		// transaction fail
		TestGetTableInfoAndTransactionFail(dataSource);
				
		// 回复原样
		TestGetTableInfoAndSelect(dataSource);
		
		// 获取列信息
		TestGetColumnInfo(dataSource);
		
		// 获取主键信息
		TestGetPrimaryKeysInfo(dataSource);
		
		// 获取外键信息
		TestGetForeignKeysInfo(dataSource);
		
		// 测试双表联合
		TestDoubleTableSelect(dataSource);
		
		// 测试三表联合
		TestTripleTableSelect(dataSource);
		
		// 测试blob数据
		TestBlob(dataSource);
	}

	public static void TestBlob(DataSource ds) throws SQLException {
		// create a table whose name is "tableName"
		IDbNonQueryOperation tableUnit = new OperableTable(ds, "AICRO", "TBL_IMAGE");
		HashMap<String, String> contents =  new HashMap<String, String> ();
		
		File directory = new File("");
		for (int i = 0; i < 4; i++) {
			String fullPathString = String.format("%s%d%s",  
					directory.getAbsolutePath() + "\\testdata\\", i + 1, ".jpg");
			contents.put("AICRO.TBL_IMAGE.id", String.format("%d", i + 1));
			contents.put("AICRO.TBL_IMAGE.image", fullPathString);
			tableUnit.getInsertPartialCommand(contents).doCommand(ds);	
		}
		
		SelectFilter selectFilter = new SelectFilter();
        selectFilter.setColumnList("*");
        List<HashMap<String, Object>> result = 
        		((IDbQueryOperation)tableUnit).getSelectCommand(selectFilter).doCommand(ds);
        
		BlobToImageHelper blobToImgHelper = new BlobToImageHelper();
		try {
			blobToImgHelper.writeBlobToFile(result.get(0).get("AICRO.TBL_IMAGE.IMAGE"), "d:\\test.bmp");	
		} catch (Exception e) {
			assert false;
		}
	}
	
	public static void TestDoubleTableSelect(DataSource ds) throws SQLException {
		// 测试两张表的join
		IDbQueryOperation tableUnit1 = new OperableTable(ds, "AICRO", "CLASS");
		IDbQueryOperation tableUnit2 = new OperableTable(ds, "AICRO", "STUDENT");
		
		CompositeTable testTable = new CompositeTable("ANY_SCHEMA_NAME", "ANY_TABLE_NAME");
		// 生成 SELECT * FROM AICRO.CLASS LEFT OUTER JOIN AICRO.STUDENT ON AICRO.CLASS.ID = AICRO.STUDENT.CLASS_ID  ORDER BY AICRO.CLASS.ID ASC
		testTable.addComponentTable(
				tableUnit1, 
				null, 
				null);
		testTable.addComponentTable(
				tableUnit2, 
				JoinType.LEFT_OUTER_JOIN, 
				tableUnit1.getTableFullName() + ".ID = " 
						+ tableUnit2.getTableFullName() + ".CLASS_ID");
		IDbQueryOperation queryDb = (IDbQueryOperation)testTable;
		SelectFilter selectFilter = new SelectFilter();
		OrderByPair orderByPair = 
				new OrderByPair(
						tableUnit1.getTableFullName() + ".ID", 
						OrderByType.ASC);
		List<OrderByPair> obp = new ArrayList<OrderByPair>();
		obp.add(orderByPair);
		selectFilter.setOrderByList(obp);
		
		ICommand command = queryDb.getSelectCommand(selectFilter);
		List<HashMap<String, Object>> rs = command.doCommand(ds);
		// 第一行
        HashMap<String, Object> tmpHash = rs.get(0);
    	if (tmpHash.size() != 7)
    	{
    		System.out.print("in TestDoubleTableSelect, resultSetMD.getColumnCount() != 7\n");
    	}
        
    	String columnName = (tableUnit1.getTableFullName() + ".id").toUpperCase();
    	int classId1 = (int)(tmpHash.get(columnName));
    	String tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
   		assert "id = 1".equals(tmpString);
   		
   		columnName = (tableUnit2.getTableFullName() + ".id").toUpperCase();
   		int classId2 = (int)(tmpHash.get(columnName));
   		assert classId1 == classId2;
   		
   		// 第二行
        tmpHash = rs.get(1);
    	if (tmpHash.size() != 7)
    	{
    		System.out.print("in TestDoubleTableSelect, resultSetMD.getColumnCount() != 7\n");
    	}
        
    	columnName = (tableUnit2.getTableFullName() + ".NAME").toUpperCase();
    	String v1 = (String)(tmpHash.get(columnName));
    	tmpString = String.format("name = %s", v1);
   		assert "name = XQ".equals(tmpString);
   		
   		columnName = (tableUnit1.getTableFullName() + ".SCHOOL_ADDR").toUpperCase();
    	v1 = (String)(tmpHash.get(columnName));
    	assert "SiPingLu".equals(v1);	
	}
	
	public static void TestTripleTableSelect(DataSource ds) throws SQLException {
		// 测试两张表的join
		IDbQueryOperation tableUnit1 = new OperableTable(ds, "AICRO", "CLASS");
		IDbQueryOperation tableUnit2 = new OperableTable(ds, "AICRO", "STUDENT");
		IDbQueryOperation tableUnit3 = new OperableTable(ds, "AICRO", "SCHOOL");
		
		CompositeTable testTable = new CompositeTable("ANY_SCHEMA_NAME", "ANY_TABLE_NAME");
		/* 生成
		   SELECT * 
		   FROM AICRO.CLASS LEFT OUTER JOIN AICRO.STUDENT ON AICRO.CLASS.ID = AICRO.STUDENT.CLASS_ID  
                            LEFT OUTER JOIN AICRO.SCHOOL ON AICRO.STUDENT.SCHOOL_ADDR = AICRO.SCHOOL.ADDR  
           ORDER BY AICRO.CLASS.ID ASC
		 * */
		testTable.addComponentTable(
				tableUnit1, 
				null, 
				null);
		testTable.addComponentTable(
				tableUnit2, 
				JoinType.LEFT_OUTER_JOIN, 
				tableUnit1.getTableFullName() + ".ID = " 
						+ tableUnit2.getTableFullName() + ".CLASS_ID");
		testTable.addComponentTable(
				tableUnit3, 
				JoinType.LEFT_OUTER_JOIN, 
				tableUnit2.getTableFullName() + ".SCHOOL_ADDR = " 
						+ tableUnit3.getTableFullName() + ".ADDR");
		
		IDbQueryOperation queryDb = (IDbQueryOperation)testTable;
		SelectFilter selectFilter = new SelectFilter();
		OrderByPair orderByPair = 
				new OrderByPair(
						tableUnit1.getTableFullName() + ".ID", 
						OrderByType.ASC);
		List<OrderByPair> obp = new ArrayList<OrderByPair>();
		obp.add(orderByPair);
		selectFilter.setOrderByList(obp);
		
		ICommand command = queryDb.getSelectCommand(selectFilter);
		List<HashMap<String, Object>> rs = command.doCommand(ds);
		// 第一行
        HashMap<String, Object> tmpHash = rs.get(0);
    	if (tmpHash.size() != 9)
    	{
    		System.out.print("in TestDoubleTableSelect, resultSetMD.getColumnCount() != 9\n");
    	}
        
    	String columnName = (tableUnit1.getTableFullName() + ".id").toUpperCase();
    	int classId1 = (int)(tmpHash.get(columnName));
    	String tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
   		assert "id = 1".equals(tmpString);
   		
   		columnName = (tableUnit2.getTableFullName() + ".id").toUpperCase();
   		int classId2 = (int)(tmpHash.get(columnName));
   		assert classId1 == classId2;
   		
   		columnName = (tableUnit2.getTableFullName() + ".SCHOOL_ADDR").toUpperCase();
   		String v1 = (String)(tmpHash.get(columnName));
   		assert v1.equals("SH");
   		
   		columnName = (tableUnit3.getTableFullName() + ".ADDR").toUpperCase();
   		v1 = (String)(tmpHash.get(columnName));
   		assert v1.equals("SH");
   		
   		// 第二行
        tmpHash = rs.get(1);
    	if (tmpHash.size() != 9)
    	{
    		System.out.print("in TestDoubleTableSelect, resultSetMD.getColumnCount() != 7\n");
    	}
        
    	columnName = (tableUnit2.getTableFullName() + ".NAME").toUpperCase();
    	v1 = (String)(tmpHash.get(columnName));
    	tmpString = String.format("name = %s", v1);
   		assert "name = XQ".equals(tmpString);
   		
   		columnName = (tableUnit1.getTableFullName() + ".SCHOOL_ADDR").toUpperCase();
    	v1 = (String)(tmpHash.get(columnName));
    	assert "SiPingLu".equals(v1);	
	}
	
	public static void TestInsertPartial(DataSource ds) throws SQLException {
		// create a table whose name is "tableName"
		IDbNonQueryOperation tableUnit = new OperableTable(ds, "AICRO", "CLASS");
		
		HashMap<String, String> contents =  new HashMap<String, String> ();
		String standard = "AICRO.CLASS";
		contents.put(standard + ".id", "50");
		contents.put(standard + ".name", "xq");
		try {
			ICommand com = tableUnit.getInsertPartialCommand(contents);
			com.doCommand(ds);
	        

			
	        SelectFilter selectFilter = new SelectFilter();
	        selectFilter.setColumnList("*");
	        selectFilter.setWhereFilter("id = 50");
	        List<HashMap<String, Object>> result = ((IDbQueryOperation)tableUnit).getSelectCommand(selectFilter).doCommand(ds);
	        
	        // 第一行
	        HashMap<String, Object> tmpHash = result.get(0);
	    	if (tmpHash.size() != 2)
	    	{
	    		System.out.print("in TestInsertPartial, result.getColumnCount() != 2\n");
	    	}
	        
	    	String columnName = (standard + ".id").toUpperCase();
	    	String tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
	   		assert "id = 50".equals(tmpString);
	   		
	    	columnName = (standard + ".name").toUpperCase();
	    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
	    	assert "name = xq".equals(tmpString);
		} catch (Exception e) {
			assert 1 != 1;
		}
		
	}
	
	public static void TestGetTableInfoAndSelect(DataSource ds) throws SQLException
	{
		// create a table whose name is "tableName"
		AbsComposibleTable tableUnit = new CompositeTable("TEST", "COMPOSITE");
		// this table is a composite table with only one inner table
		tableUnit.addComponentTable(
				new OperableTable(ds, "AICRO", "CLASS"),
				JoinType.NOT_KNOWN, "");
		
		// IOperableTable 也是 IShowTable
		assert tableUnit instanceof AbsComposibleTable;
		IDbQueryOperation showTable = (IDbQueryOperation)tableUnit;
		
		String standard = "AICRO.CLASS";
        
		HashMap<String, IBasicTableOperation> componentTable = 
				((AbsComposibleTable)showTable).getComponentTables();
		Set<String> nameSet = componentTable.keySet();
		Iterator<String> it = nameSet.iterator();
		while(it.hasNext()){
            String name = it.next();
            if (!name.equals(standard))
            {
            	System.out.print("in TestGetTableInfo, name != AICRO.CLASS\n");	
            }
            	
            // 只有一个对象
            if (it.hasNext() != false)
            {
            	System.out.print("in TestGetTableInfo, it.hasNext() != false\n");
            }
		}

        if (null == ((AbsComposibleTable)showTable).getJoinOnFilters())
        {
        	System.out.print("in TestGetTableInfo, null == showTable.GetJoinOnFilters()\n");
        }
		

        SelectFilter selectFilter = new SelectFilter();
        selectFilter.setColumnList("*");
        List<HashMap<String, Object>> rs = showTable.getSelectCommand(selectFilter).doCommand(ds);
        
        // 第一行
        HashMap<String, Object> tmpHash = rs.get(0);
    	if (tmpHash.size() != 2)
    	{
    		System.out.print("in TestGetTableInfo, resultSetMD.getColumnCount() != 2\n");
    	}
        
    	String columnName = (standard + ".id").toUpperCase();
    	String tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
   		assert "id = 1".equals(tmpString);
   		
    	columnName = (standard + ".name").toUpperCase();
    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
    	assert "name = class1".equals(tmpString);
    	
    	// 第二行
    	tmpHash = rs.get(1);
    	if (tmpHash.size() != 2)
    	{
    		System.out.print("in TestGetTableInfo, resultSetMD.getColumnCount() != 2\n");
    	}
        
    	columnName = (standard + ".id").toUpperCase();
    	tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
    	assert "id = 2".equals(tmpString);
    	
    	columnName = (standard + ".name").toUpperCase();
    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
    	assert "name = class2".equals(tmpString);	
	}
	
	public static void TestGetTableInfoAndUpdate(DataSource ds) throws SQLException
	{
		// create a table whose name is "tableName"
		OperableTable tableUnit = new OperableTable(ds, "AICRO", "CLASS");

		// IOperableTable 也是 IDbQueryTable
		assert tableUnit instanceof IDbQueryOperation;
		
		String standard = "AICRO.CLASS";
        
		String tableName = tableUnit.getTableFullName();
		assert tableName.equals(standard);
		
        ICommand com = tableUnit.getUpdateCommand("name = 'class2'", "name = 'class3'");
        com.doCommand(ds);
        
        SelectFilter sf = new SelectFilter();
        sf.setColumnList("*");
        List<HashMap<String, Object>> rs = tableUnit.getSelectCommand(sf).doCommand(ds);
        // 第一行
        HashMap<String, Object> tmpHash = rs.get(0);
    	if (tmpHash.size() != 2)
    	{
    		System.out.print("in TestGetTableInfo, resultSetMD.getColumnCount() != 2\n");
    	}
        
    	String columnName = (standard + ".id").toUpperCase();
    	String tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
   		assert "id = 1".equals(tmpString);
   		
    	columnName = (standard + ".name").toUpperCase();
    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
    	assert "name = class1".equals(tmpString);
    	
    	// 第二行
    	tmpHash = rs.get(1);
    	if (tmpHash.size() != 2)
    	{
    		System.out.print("in TestGetTableInfo, resultSetMD.getColumnCount() != 2\n");
    	}
        
    	columnName = (standard + ".id").toUpperCase();
    	tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
    	assert "id = 2".equals(tmpString);
    	
    	columnName = (standard + ".name").toUpperCase();
    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
    	assert "name = class3".equals(tmpString);	
    	
    	// 还原
    	com = tableUnit.getUpdateCommand("name = 'class3'", "name = 'class2'");
        com.doCommand(ds);
	}
	
	public static void TestGetTableInfoAndTransactionOk(DataSource ds) throws SQLException
	{
		// create a table whose name is "tableName"
		OperableTable tableUnit = new OperableTable(ds, "AICRO", "CLASS");
		OperableTable tableUnit2 = new OperableTable(ds, "AICRO", "CLASS");

		// IOperableTable 也是 IShowTable
		assert tableUnit instanceof IDbQueryOperation;
		
		String standard = "AICRO.CLASS";
		
        // 设置事务
        IJobManager jobManager = new TransactionHelper(ds);
        ICommand com = tableUnit.getUpdateCommand("name = 'class2'", "name = 'class3'");
        jobManager.addJob(com);
        com = tableUnit2.getUpdateCommand("name = 'class1'", "name = 'class4'");
        jobManager.addJob(com);
        
        // 做事务
        List<List<HashMap<String, Object>>> jobResultList = jobManager.doJobsInTransaction();
        
        // 由于两个事务都是update事务，所以结果一定也是两个
        assert jobResultList.size() == 2;
        
        // update动作时没有返回值的
        assert jobResultList.get(0).size() == 0;
        assert jobResultList.get(1).size() == 0;
        
        SelectFilter sf = new SelectFilter();
        sf.setColumnList("*");
        List<HashMap<String, Object>> rs = tableUnit.getSelectCommand(sf).doCommand(ds);
        // 第一行
        HashMap<String, Object> tmpHash = rs.get(0);
    	if (tmpHash.size() != 2)
    	{
    		System.out.print("in TestGetTableInfo, resultSetMD.getColumnCount() != 2\n");
    	}
        
    	String columnName = (standard + ".id").toUpperCase();
    	String tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
   		assert "id = 1".equals(tmpString);
   		
    	columnName = (standard + ".name").toUpperCase();
    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
    	assert "name = class4".equals(tmpString);
    	
    	// 第二行
    	tmpHash = rs.get(1);
    	if (tmpHash.size() != 2)
    	{
    		System.out.print("in TestGetTableInfo, resultSetMD.getColumnCount() != 2\n");
    	}
        
    	columnName = (standard + ".id").toUpperCase();
    	tmpString = String.format("id = %d", (int)(tmpHash.get(columnName)));
    	assert "id = 2".equals(tmpString);
    	
    	columnName = (standard + ".name").toUpperCase();
    	tmpString = String.format("name = %s", (String)(tmpHash.get(columnName)));
    	assert "name = class3".equals(tmpString);	
    	
    	// 还原
    	com = tableUnit.getUpdateCommand("name = 'class3'", "name = 'class2'");
        com.doCommand(ds);
        com = tableUnit.getUpdateCommand("name = 'class4'", "name = 'class1'");
        com.doCommand(ds);
	}
	
	public static void TestGetTableInfoAndTransactionFail(DataSource ds) throws SQLException
	{
		// create a table whose name is "tableName"
		OperableTable tableUnit = new OperableTable(ds, "AICRO", "CLASS");
		// 在此故意失败
		OperableTable tableUnit2 = new OperableTable(ds, "AICRO", "CLASS");
		
        // 设置事务
        IJobManager jobManager = new TransactionHelper(ds);
        ICommand com = tableUnit.getUpdateCommand("name = 'class2'", "name = 'class3'");
        jobManager.addJob(com);
        com = tableUnit2.getUpdateCommand("name = 'class1'", "nam = 'class4'");
        jobManager.addJob(com);
        
        // 做事务
        String errMsg = new String("no error");
        assert null == jobManager.doJobsInTransaction();
        errMsg = jobManager.getLastError();
        assert !(errMsg.equals("no error"));
        
        // 应该是失败状态，所以不用还原
	}
	
	public static void TestGetColumnInfo(DataSource dataSource) throws SQLException
	{
		// create a table whose name is "tableName"
		IBasicTableOperation tableUnit = new OperableTable(dataSource, "AICRO", "CLASS");
		
		HashMap<String, IColumnProperty> columns = tableUnit.getAllColumns();
		Collection<IColumnProperty> columnCollection = columns.values();
		Iterator<IColumnProperty> it = columnCollection.iterator();
		
		for (int i = 0; i < columnCollection.size(); i++)
		{
			IColumnProperty columnProperty = it.next();
			if (columnProperty.getColumnFullName().equals("AICRO.CLASS.ID"))
			{
				// 第一列
				assert columnProperty.defaultValue() == null;
				assert columnProperty.isAutoIncrement() == false;
				assert columnProperty.getBelongingTable() == tableUnit;
				assert columnProperty.getDataTypeName().contains("INT");
				assert columnProperty.isNullable() == true;
				assert columnProperty.indexOfTable() == 0;
				continue;
			}
			if (columnProperty.getColumnFullName().equals("AICRO.CLASS.NAME"))
			{
				// 第二列
				assert columnProperty.defaultValue() == null;
				assert columnProperty.isAutoIncrement() == false;
				assert columnProperty.getBelongingTable() == tableUnit;
				assert columnProperty.getDataTypeName().contains("VARCHAR");
				assert columnProperty.isNullable() == true;
				assert columnProperty.indexOfTable() == 1;
				continue;
			}
			
			// should not be here
			assert 1 != 1;
		}
	}
	
	public static void TestGetPrimaryKeysInfo(DataSource dataSource) throws SQLException
	{
		// create a table whose name is "tableName"
		IBasicTableOperation tableUnit = new OperableTable(dataSource, "AICRO", "SCHOOL");
		
		HashMap<String, IColumnProperty> primaryKeys = tableUnit.getPrimaryKey();
		Collection<IColumnProperty> primarycolumnCollection = primaryKeys.values();
		Iterator<IColumnProperty> it = primarycolumnCollection.iterator();
		
		for (int i = 0; i < primarycolumnCollection.size(); i++)
		{
			IColumnProperty columnProperty = it.next();
			if (columnProperty.getColumnFullName().equals("AICRO.SCHOOL.ADDR"))
			{
				// 第一列
				assert columnProperty.defaultValue().equals("'SH'");
				assert columnProperty.isAutoIncrement() == false;
				assert columnProperty.getBelongingTable() == tableUnit;
				assert columnProperty.getDataTypeName().contains("VARCHAR");
				assert columnProperty.isNullable() == false;
				assert columnProperty.indexOfTable() == 1;
				continue;
			}
			if (columnProperty.getColumnFullName().equals("AICRO.SCHOOL.NAME"))
			{
				// 第二列
				assert columnProperty.defaultValue() == null;
				assert columnProperty.isAutoIncrement() == false;
				assert columnProperty.getBelongingTable() == tableUnit;
				assert columnProperty.getDataTypeName().contains("VARCHAR");
				assert columnProperty.isNullable() == false;
				assert columnProperty.indexOfTable() == 0;
				continue;
			}
			
			// should not be here
			assert 1 != 1;
		}
	}
	
	public static void TestGetForeignKeysInfo(DataSource dataSource) throws SQLException
	{
		// create a table whose name is "tableName"
		IBasicTableOperation tableUnit = new OperableTable(dataSource, "AICRO", "STUDENT");
		
		List< List<IForeignKeyColumnProperty> > foreignKeysList = tableUnit.getForeignKey();
		
		Iterator<List<IForeignKeyColumnProperty>> itFkGroupList = foreignKeysList.iterator();
		while (itFkGroupList.hasNext()) {
			List<IForeignKeyColumnProperty> foreignKeyGroup = itFkGroupList.next();
			
			Iterator<IForeignKeyColumnProperty> itFkGroup = foreignKeyGroup.iterator();
			while (itFkGroup.hasNext())
			{
				IForeignKeyColumnProperty fkColumnProperty = itFkGroup.next();
				
				assert fkColumnProperty.getForeignKeyTable() == tableUnit;
				
				if (fkColumnProperty.getPrimaryKeyTable().getTableName().equals("CLASS"))
				{
					assert fkColumnProperty.getForeignKeyConstraintName().equals("FK_CLASS_INFO");
					assert fkColumnProperty.getForeignKeyColumn().getColumnFullName().equals("AICRO.STUDENT.CLASS_ID");
					assert fkColumnProperty.getCorrespondingPrimaryKeyColumn().getColumnFullName().equals("AICRO.STUDENT.ID");
					continue;
				}
				
				if (fkColumnProperty.getPrimaryKeyTable().getTableName().equals("SCHOOL"))
				{
					assert fkColumnProperty.getForeignKeyConstraintName().equals("FK_SCHOOL_INFO");
					if (fkColumnProperty.getForeignKeyColumn().getColumnFullName().equals("AICRO.SCHOOL.SCHOOL_NAME") )
					{
						assert fkColumnProperty.getCorrespondingPrimaryKeyColumn().getColumnFullName().equals("AICRO.SCHOOL.NAME");	
					}
					else if (fkColumnProperty.getForeignKeyColumn().getColumnFullName().equals("AICRO.SCHOOL.SCHOOL_ADDR") )
					{
						assert fkColumnProperty.getCorrespondingPrimaryKeyColumn().getColumnFullName().equals("AICRO.SCHOOL.ADDR");
					}
					else 
					{
						assert 1 != 1;		
					}
					
					continue;
				}
				
				assert 1 != 1;
			}
		}
	}
	
}
